package com.tito.common.framework.controller;


import com.tito.common.api.ResultBean;

public abstract class GenericController<T> {

    protected <T> ResultBean<T> getSuccessResult(T data, String msg){
        ResultBean<T> ResultBean = new ResultBean<T>();
        ResultBean.setOk(true);
        ResultBean.setMsg(msg);
        ResultBean.setData(data);
        return ResultBean;
    }

    protected <T> ResultBean<T>  getSuccessResult(T data) {
        ResultBean<T> ResultBean = new ResultBean<T>();
        ResultBean.setOk(true);
        ResultBean.setMsg("请求成功");
        ResultBean.setData(data);
        return ResultBean;
    }


    protected ResultBean<String> getSuccessResult(String msg) {
        ResultBean<String> ResultBean = new ResultBean<String>();
        ResultBean.setOk(true);
        ResultBean.setMsg(msg);
        return ResultBean;
    }

    protected ResultBean<String> getFailResult(String msg) {
        ResultBean<String> ResultBean = new ResultBean<String>();
        ResultBean.setOk(false);
        ResultBean.setMsg(msg);
        return ResultBean;
    }
}
